package com.nettylearning.base.netty.tomcat.http;

import com.nettylearning.base.netty.io.bio.tomcat.GPRequest;
import com.nettylearning.base.netty.io.bio.tomcat.GPResponse;

/**
 * @author vince
 * @date 2021/7/24 21:32
 * @description 定义GPServlet抽象类
 * @Version 1.0
 */
public abstract class GPServlet {
    public void service(GPRequest request, GPResponse response) throws Exception {
        // 由service()方法决定是调用doGet()还是调用doPost()
        if ("GET".equalsIgnoreCase(request.getMethod())) {
            doGet(request, response);
        } else {
            doPost(request, response);
        }
    }

    public abstract void doGet(GPRequest request, GPResponse response) throws Exception;

    public abstract void doPost(GPRequest request, GPResponse response) throws Exception;
}
